﻿using System;

namespace NetTopologySuite.Features
{
	public static class FeatureExtensions
	{
		public static string IdAttributeName { get; set; } //= "id";

		public static object ID(IFeature feature)
		{
			if (!FeatureExtensions.HasID(feature))
			{
				return null;
			}
			return feature.Attributes[FeatureExtensions.IdAttributeName];
		}

		public static bool HasID(IFeature feature)
		{
			if (feature == null)
			{
				throw new System.ArgumentNullException("feature");
			}
			return feature.Attributes.Exists(FeatureExtensions.IdAttributeName);
		}
	}
}
